﻿using System;
using Microsoft.AspNetCore.Mvc;
using VegetableSale.NET.Entities;
using VegetableSale.NET.Services;

[ApiController]
[Route("api/[Action]")]
public class UserController : Controller
{
    private UserService _userService = new UserService();

    [HttpPost(Name= "userlist")]
    public Result userlist([FromBody]QueryDTO queryDTO)
    {
        return _userService.getUserList(queryDTO);
    }

    [HttpPost(Name = "useradd")]
    public Result useradd([FromBody] User user)
    {
        return _userService.addUser(user);
    }

    [HttpPost(Name ="userdelete")]
    public Result userdelete(int id)
    {
        return _userService.userDelete(id);
    }

    [HttpPost(Name ="userupdate")]
    public Result userupdate([FromBody] User user)
    {
        return _userService.userUpdate(user);
    }
}

